<template>
  
    <div style="position:relative;"
        :style="'margin-top:'+marginTop+'px'">
        <van-image 
            :width="imageW" :height="imageH" fit="fill" 
            style="position: absolute; left:50%;transform: translateX(-50%);"
            :src="getImageUrl(imageUrl)" 
        /> 
    </div>

</template>
<script lang="ts" setup>
    import { ref,defineProps} from 'vue';
    //name 为图片的名称 包含 图片后缀
    const getImageUrl = (name:string) => {
        return new URL(`../../assets/${name}`, import.meta.url).href;
    }
    defineProps({
        imageUrl: {
            type: String,
            default: '/images/noData/no-cart.png'
        },
        marginTop: {
            type: Number,
            default: 0
        },
        imageW: {
            type: Number,
            default: 200
        },
        imageH: {
            type: Number,
            default: 200
        }
    })
</script>
<style lang="scss" scoped>


</style>